import axios from "axios";

const request = axios.create({
    // 基础路径
    // baseURL: import.meta.env.VITE_APP_BASE_API,
    baseURL: "http://localhost:8080/chat",
    timeout: 5000, // 超时的时间
    // 添加请求头
    headers: {
        "Content-type": "application/json;charset=UTF-8",
    }
})

// 响应拦截器
request.interceptors.response.use(response => {
    if (response.status === 200) {
        return response.data;
    } else {
        return Promise.reject(new Error('请求错误'))
    }
})
export default request;